home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Mac Game Programming Gurus / TricksOfTheMacGameProgrammingGurus.iso / More Source / C⁄C++ / Xconq 7.0d37 / source / kernel / compile.c < prev    next >
Encoding:
C/C++ Source or Header  |  1995-01-06  |  4.2 KB  |  129 lines  |  [TEXT/KAHL]

  1. /* Compiler for game modules.
  2.    Copyright (C) 1991, 1992, 1993, 1994, 1995 Stanley T. Shebs.
  3.  
  4. Xconq is free software; you can redistribute it and/or modify
  5. it under the terms of the GNU General Public License as published by
  6. the Free Software Foundation; either version 2, or (at your option)
  7. any later version.  See the file COPYING.  */
  8.  
  9. #include "config.h"
  10.  
  11. #ifdef COMPILER
  12.  
  13. #include "misc.h"
  14.  
  15. #undef SPECIAL
  16.  
  17. #include "game.h"
  18.  
  19. void compile PROTO ((void));
  20.  
  21. void
  22. compile()
  23. {
  24. #ifdef __GNUC__
  25.     /* (Decide what is to be precompiled?) */
  26. /*    printf("#define SPECIAL\n\n");  */
  27.     /* The numbers of types are identical to their max limits. */
  28.     printf("#undef  MAXUTYPES\n");
  29.     printf("#define MAXUTYPES (%d)\n", max(1, numutypes));
  30.     printf("#define numutypes (%d)\n", numutypes);
  31. /*    printf("const short numutypes = %d;\n", numutypes);  */
  32.     printf("#undef  MAXMTYPES\n");
  33.     printf("#define MAXMTYPES (%d)\n", max(1, nummtypes));
  34.     printf("#define nummtypes (%d)\n", nummtypes);
  35. /*    printf("const short nummtypes = %d;\n", nummtypes);  */
  36.     printf("#undef  MAXTTYPES\n");
  37.     printf("#define MAXTTYPES (%d)\n", max(1, numttypes));
  38.     printf("#define numttypes (%d)\n", numttypes);
  39. /*    printf("const short numttypes = %d;\n", numttypes);  */
  40.     /* Now dump out definitions for Property accessors. */
  41.  
  42. #undef  DEF_VAR_I
  43. #define DEF_VAR_I(str,FNAME,SETFNAME,doc,VAR,lo,DFLT,hi)  \
  44.     printf("#define %s() (%d)\n", # FNAME, DFLT);  \
  45.     printf("#define %s(v)  run_warning(\"can't set\")\n", # SETFNAME);
  46. #undef  DEF_VAR_S
  47. #define DEF_VAR_S(str,FNAME,SETFNAME,doc,VAR,DFLT)  \
  48.     printf("#define %s() (\"%s\")\n", # FNAME, DFLT);  \
  49.     printf("#define %s(v)  run_warning(\"can't set\")\n", # SETFNAME);
  50. #undef  DEF_VAR_L
  51. #define DEF_VAR_L(str,FNAME,SETFNAME,doc,VAR,DFLT)  \
  52.     printf("#define %s() (DFLT != NULL ? lispnil : 0)\n", # FNAME);  \
  53.     printf("#define %s(v)  run_warning(\"can't set\")\n", # SETFNAME);
  54.  
  55. #include "gvar.def"
  56.  
  57. /* Define functions for all unit type properties. */
  58.  
  59. #undef  DEF_UPROP_I
  60. #define DEF_UPROP_I(name,fname,doc,slot,lo,DFLT,hi)  \
  61.     printf("#define %s(u) (%d)\n", # fname, DFLT);
  62. #undef  DEF_UPROP_S
  63. #define DEF_UPROP_S(name,fname,doc,slot,DFLT)  \
  64.     printf("#define %s(u) (\"%s\")\n", # fname, DFLT);
  65. #undef  DEF_UPROP_L
  66. #define DEF_UPROP_L(name,fname,doc,slot)  \
  67.     printf("#define %s(u) (lispnil)\n", # fname);
  68.  
  69. #include "utype.def"
  70.  
  71. /* Define functions for all material type properties. */
  72.  
  73. #undef  DEF_MPROP_I
  74. #define DEF_MPROP_I(name,fname,doc,slot,lo,DFLT,hi)  \
  75.     printf("#define %s(u) (%d)\n", # fname, DFLT);
  76. #undef  DEF_MPROP_S
  77. #define DEF_MPROP_S(name,fname,doc,slot,DFLT)  \
  78.     printf("#define %s(u) (\"%s\")\n", # fname, DFLT);
  79. #undef  DEF_MPROP_L
  80. #define DEF_MPROP_L(name,fname,doc,slot)  \
  81.     printf("#define %s(u) (lispnil)\n", # fname);
  82.  
  83. #include "mtype.def"
  84.  
  85. /* Define functions for all terrain type properties. */
  86.  
  87. #undef  DEF_TPROP_I
  88. #define DEF_TPROP_I(name,fname,doc,slot,lo,DFLT,hi)  \
  89.     printf("#define %s(u) (%d)\n", # fname, DFLT);
  90. #undef  DEF_TPROP_S
  91. #define DEF_TPROP_S(name,fname,doc,slot,DFLT)  \
  92.     printf("#define %s(u) (\"%s\")\n", # fname, DFLT);
  93. #undef  DEF_TPROP_L
  94. #define DEF_TPROP_L(name,fname,doc,slot)  \
  95.     printf("#define %s(u) (lispnil)\n", # fname);
  96.  
  97. #include "ttype.def"
  98.  
  99. /* Define functions for all the tables. */
  100.  
  101. #undef  DEF_UU_TABLE
  102. #define DEF_UU_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  103.     printf("#define %s(u1,u2) (%d)\n", # FNAME, DFLT);
  104. #undef  DEF_UM_TABLE
  105. #define DEF_UM_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  106.     printf("#define %s(u1,u2) (%d)\n", # FNAME, DFLT);
  107. #undef  DEF_UT_TABLE
  108. #define DEF_UT_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  109.     printf("#define %s(u1,u2) (%d)\n", # FNAME, DFLT);
  110. #undef  DEF_TM_TABLE
  111. #define DEF_TM_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  112.     printf("#define %s(t1,t2) (%d)\n", # FNAME, DFLT);
  113. #undef  DEF_TT_TABLE
  114. #define DEF_TT_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  115.     printf("#define %s(t1,t2) (%d)\n", # FNAME, DFLT);
  116. #undef  DEF_MM_TABLE
  117. #define DEF_MM_TABLE(name,FNAME,doc,table,slot,lo,DFLT,hi)  \
  118.     printf("#define %s(t1,t2) (%d)\n", # FNAME, DFLT);
  119.  
  120. #include "table.def"
  121.  
  122. #endif /* __GNUC__ */
  123. }
  124.  
  125. /* Compiler should disable unused init methods? */
  126.  
  127. #endif /* COMPILER */
  128.  
  129.